<% if params[:controller] == "appointments" %>
<p>
  <% prescription.drugs.each do | d | %>
  <strong>Drug:</strong><%= d.name %></br>
  <strong>Dosage:</strong><%= prescription.dosage %></br>
  <strong>Quantity:</strong><%= prescription.quantity %></br>
  <strong>Fee:</strong><%= prescription.fee %></br>
  <strong>Note:</strong><%= prescription.note %></br>
  <%= link_to 'Edit', edit_appointment_prescription_path(:id => prescription, :appointment_id => params[:id]) %> | 
  <%= link_to 'Destroy',appointment_prescription_path(:id => prescription, :appointment_id => params[:id]), method: :delete, data: { confirm: 'Are you sure?' }%>
  <% end %>
</p>
<% else %>
<tr>	
  <td><%= prescription.id %></td>
  <td><%= prescription.appointment.patient.full_name %></td>
  <td><%= prescription.dosage %></td>
  <td><%= prescription.quantity %></td>
  <td><%= prescription.fee %></td>
  <td><%= prescription.note %></td>
  <td>
  <%= link_to 'Edit', edit_appointment_prescription_path(:id => prescription, :appointment_id => params[:id]) %> | 
  <%= link_to 'Destroy',appointment_prescription_path(:id => prescription, :appointment_id => params[:id]), method: :delete, data: { confirm: 'Are you sure?' }%>
  </td>
</tr>
<% end %>